<?php
// TODO this should be shifted back to the base item form. these are all properties that are stored in the items table
class DigCms_Form_Page extends DigCms_Form_Item {
    /**
     * we use the construct method here to leave the init() method open for extending forms
     *
     * @param array $options
     */
    public function __construct($options = array()) {
        parent::__construct($options);

        $title = $this->addElement('text', 'headline', array(
                'label'	    => 'Headline',
                'required'	=> false,
                'order'	=> 1
        ));

        $this->addElement('text', 'page_title', array(
                'label'	    => 'Page Title',
                'required'	=> false,
                'description'   => 'If you want this title to replace the entire page title preceed it with a forward slash, eg: /my new title.'
        ));

        $meta_keywords = $this->addElement('text', 'meta_keywords', array(
                'label'	    => 'Meta Keywords',
                'required'	=> false
        ));

        $meta_description = $this->addElement('text', 'meta_description', array(
                'label'	    => 'Meta Description',
                'required'	=> false
        ));
        $this->addElement('select', 'navigation_item', array(
                'label'	        => 'Show this Item on the Menu?',
                'multioptions'	=> array(
                    1   => 'Yes',
                    0   => 'No'
                ),
                'required'	    => false
        ));
        $this->addElement('text', 'label', array(
                'label'	    => 'Menu Label',
                'required'	=> false
        ));

        $this->addElement('text', 'slug', array(
                'label'	    => 'URL Slug',
                'required'	=> false
        ));

        $this->addElement('text', 'legacy_url', array(
                'label'	    => 'Legacy Url',
                'required'	=> false,
                'description'   => 'Any request to the legacy URL will map to this item, and will set a 301 permanent redirect header.'
        ));

        $templates = DigUi_Service_Template::listTemplates();
        $options = array();
        $options[] = 'Default Skin';
        foreach ($templates as $template) {
            $skins = DigUi_Service_Template::listSkins($template);
            foreach ($skins as $skin) {
                $options[$template . '->' . $skin] = $template . ' / ' . $skin;
            }
        }

        $skin = $this->addElement('select', 'skin', array(
                'label'	        => 'Skin',
                'multioptions'	=> $options,
                'required'	    => false
        ));

        $this->addDisplayGroup(array('page_title', 'navigation_item', 'label','slug','legacy_url', 'redirect', 'meta_description', 'meta_keywords', 'parent_id', 'skin'),
                'options', array('class' => 'toggle_content', 'order' => 2));
    }
}
?>